//
//  Tobacco.m
//  OC1_类和对象课后作业
//
//  Created by dllo on 15/10/22.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "Tobacco.h"

@implementation Tobacco

-(id)init
{

    _name = @"长白山";
    _price = 11;
    [self info];
    return self;

}

-(void)info
{

    NSLog(@"%@ %ld", _name, _price);

}

-(void)buy
{

    NSLog(@"来一包%ld的%@", _price, _name);

}

-(id)initWithName:(NSString *)name price:(NSInteger)price
{
    _name = name;
    _price = price;
    return self;
}

-(NSString *)name
{
    return _name;
}

-(void)setName:(NSString *)name
{
    _name = name;
}
-(NSInteger)price
{
    return _price;
}
-(void)setPrice:(NSInteger)price
{
    _price = price;
}


+ (id)tobaccoWithName:(NSString *)name price:(NSInteger)price
{
    Tobacco *t = [[Tobacco alloc] initWithName:name price:price];
    return t;
}



@end
